close all;clear;clc;

%导入数据
dataDir = "..\data\";

url = dataDir + "附件1：不同人数的STR图谱数据.xlsx";
data1 = readtable(url,"VariableNamingRule","preserve");
data1(:,{'Dye'}) = [];

for i=1 : 100
    row = "Allele " + i;
    row = cellstr(row);
    data1(:,row) = [];
end

%定义图例
sample{16} = [];
for i = 1:16
    sample(i) = data1.Marker(i);
end

%开始画图
title(data1.("Sample File")(1));

%设置颜色
color = ["#2D8875", "#52AADC", "#7C7979", "#7FABD1", "#91ccc0", "#963B79", "#97D0C5", "#B5CE4E", "#BD7795", "#C7C1DE", "#C89736", "#D75B4E", "#EC6E66", "#EEB6D4", "#F39865", "#F7AC53"];

%画图
for j = 1:16:816
    %获取屏幕大小
    scrsz = get(0, "ScreenSize");
    figureNum = (j-1)/16 + 1;
    figure(figureNum);
    set(figureNum, "Position",[0, 30, scrsz(3), scrsz(4)-95]);

    %定义x坐标
    X = table2array(data1(j:j+15,3:2:100)); 

    %定义y坐标
    Y = table2array(data1(j:j+15,4:2:100));

    for i=1:16
        plot(X(i,:),Y(i,:),Marker="o",LineWidth=1,Color=color(i));
        hold on;
    end

    %设置图例
    lgd = legend(sample);
    lgd.NumColumns = 2;             %分成两列
    lgd.Title.String = data1.("Sample File")(j);
    
    %保存图片到本地
    name = string(data1.("Sample File")(j)) + ".png";
    saveas(gcf,name,"png");
end